<template>
  <div class="inspiration-container">
    <div class="background-wrapper"></div>
    <div class="content">
      <!-- 导航栏组件 -->
      <Navbar />

      <!-- 灵感启发页面主要内容 -->
      <section class="inspiration-main">
        <div class="inspiration-content">
          <h2 class="page-title">创作灵感指导</h2>
          <p class="page-description">
            探索AI艺术创作的无限可能，获取专业创作技巧和灵感启发，助您轻松开启创意之旅。
          </p>
          
          <!-- 创作领域标签页 -->
          <div class="domain-tabs">
            <button 
              v-for="domain in domains" 
              :key="domain.id"
              :class="{ active: activeDomain === domain.id }"
              @click="activeDomain = domain.id"
              class="domain-tab"
            >
              {{ domain.name }}
            </button>
          </div>
          
          <!-- AI绘画板块 -->
          <div v-show="activeDomain === 'painting'" class="domain-content">
            <!-- 创作技巧指导区 -->
            <div class="technique-section">
              <h3>🎨 热门艺术风格</h3>
              <div class="technique-grid">
                <div class="technique-card" v-for="technique in paintingTechniques" :key="technique.id">
                  <div class="technique-icon">{{ technique.icon }}</div>
                  <h4>{{ technique.name }}</h4>
                  <p>{{ technique.description }}</p>
                </div>
              </div>
            </div>
            
            <!-- 案例展示区 -->
            <div class="cases-section">
              <h3>🖼️ 风格案例展示</h3>
              <div class="cases-grid">
                <div class="case-card" v-for="caseItem in paintingCases" :key="caseItem.id">
                  <div class="case-image">
                    <div class="placeholder">{{ caseItem.emoji }}</div>
                  </div>
                  <div class="case-info">
                    <h4>{{ caseItem.style }}</h4>
                    <p>{{ caseItem.description }}</p>
                    <div class="case-tags">
                      <span class="tag" v-for="tag in caseItem.keywords" :key="tag">{{ tag }}</span>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            
            <!-- 关键词推荐区 -->
            <div class="keywords-section">
              <h3>📐 构图技巧标签</h3>
              <div class="keywords-container">
                <div class="keyword-tag" v-for="keyword in paintingKeywords" :key="keyword">
                  {{ keyword }}
                </div>
              </div>
            </div>
          </div>
          
          <!-- AI音乐板块 -->
          <div v-show="activeDomain === 'music'" class="domain-content">
            <!-- 创作技巧指导区 -->
            <div class="technique-section">
              <h3>🎵 风格情绪搭配</h3>
              <div class="technique-grid">
                <div class="technique-card" v-for="technique in musicTechniques" :key="technique.id">
                  <div class="technique-icon">{{ technique.icon }}</div>
                  <h4>{{ technique.name }}</h4>
                  <p>{{ technique.description }}</p>
                </div>
              </div>
            </div>
            
            <!-- 案例展示区 -->
            <div class="cases-section">
              <h3>🎶 音乐风格案例</h3>
              <div class="cases-grid">
                <div class="case-card" v-for="caseItem in musicCases" :key="caseItem.id">
                  <div class="case-image">
                    <div class="placeholder">{{ caseItem.emoji }}</div>
                  </div>
                  <div class="case-info">
                    <h4>{{ caseItem.style }}</h4>
                    <p>{{ caseItem.description }}</p>
                    <div class="case-tags">
                      <span class="tag" v-for="tag in caseItem.keywords" :key="tag">{{ tag }}</span>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            
            <!-- 关键词推荐区 -->
            <div class="keywords-section">
              <h3>🎼 乐器组合标签</h3>
              <div class="keywords-container">
                <div class="keyword-tag" v-for="keyword in musicKeywords" :key="keyword">
                  {{ keyword }}
                </div>
              </div>
            </div>
          </div>
          
          <!-- AI写作板块 -->
          <div v-show="activeDomain === 'writing'" class="domain-content">
            <!-- 创作技巧指导区 -->
            <div class="technique-section">
              <h3>✍️ 文体写作技巧</h3>
              <div class="technique-grid">
                <div class="technique-card" v-for="technique in writingTechniques" :key="technique.id">
                  <div class="technique-icon">{{ technique.icon }}</div>
                  <h4>{{ technique.name }}</h4>
                  <p>{{ technique.description }}</p>
                </div>
              </div>
            </div>
            
            <!-- 案例展示区 -->
            <div class="cases-section">
              <h3>📖 写作案例展示</h3>
              <div class="cases-grid">
                <div class="case-card" v-for="caseItem in writingCases" :key="caseItem.id">
                  <div class="case-image">
                    <div class="placeholder">{{ caseItem.emoji }}</div>
                  </div>
                  <div class="case-info">
                    <h4>{{ caseItem.style }}</h4>
                    <p>{{ caseItem.description }}</p>
                    <div class="case-tags">
                      <span class="tag" v-for="tag in caseItem.keywords" :key="tag">{{ tag }}</span>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            
            <!-- 关键词推荐区 -->
            <div class="keywords-section">
              <h3>📑 文案结构要素</h3>
              <div class="keywords-container">
                <div class="keyword-tag" v-for="keyword in writingKeywords" :key="keyword">
                  {{ keyword }}
                </div>
              </div>
            </div>
          </div>
        </div>
      </section>

      <!-- 底部 -->
      <footer class="footer">
        <p>© 2025 AI 艺术创作平台 - 让创意无界，让 AI 赋能艺术创作</p>
      </footer>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, computed, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import Navbar from '../components/Navbar.vue'

const router = useRouter()

// 活跃的创作领域
const activeDomain = ref('painting')

// 创作领域标签
const domains = ref([
  { id: 'painting', name: 'AI绘画' },
  { id: 'music', name: 'AI音乐' },
  { id: 'writing', name: 'AI写作' }
])

// AI绘画板块数据
const paintingTechniques = ref([
  { id: 1, icon: '🎨', name: '油画风格', description: '经典油画质感，厚重笔触与丰富色彩层次' },
  { id: 2, icon: '💧', name: '水彩风格', description: '清新透明质感，流畅色彩过渡效果' },
  { id: 3, icon: '🇨🇳', name: '国潮风格', description: '中国传统元素与现代设计相结合' },
  { id: 4, icon: '👾', name: '像素艺术', description: '复古像素风格，适用于游戏和插画' },
  { id: 5, icon: '🌃', name: '赛博朋克', description: '未来科技感，霓虹色彩与机械元素' }
])

const paintingCases = ref([
  {
    id: 1,
    emoji: '🌆',
    style: '赛博朋克都市',
    description: '融合未来科技与都市夜景的视觉冲击',
    keywords: ['未来城市', '赛博朋克', '霓虹色彩']
  },
  {
    id: 2,
    emoji: '🏞️',
    style: '国风水墨',
    description: '传统水墨画风与现代构图的完美结合',
    keywords: ['山水意境', '国风元素', '留白艺术']
  },
  {
    id: 3,
    emoji: '🏰',
    style: '奇幻城堡',
    description: '充满想象力的魔幻建筑与场景设计',
    keywords: ['童话风格', '梦幻色彩', '细节丰富']
  }
])

const paintingKeywords = ref([
  '三分法构图', '对角线构图', '黄金比例', '前景框架', 
  '引导线', '对称构图', '填充画面', '留白艺术',
  '透视关系', '景深控制'
])

// AI音乐板块数据
const musicTechniques = ref([
  { id: 1, icon: '😄', name: '轻快愉悦', description: '明快节奏，积极向上的音乐情绪' },
  { id: 2, icon: '😢', name: '忧郁深沉', description: '缓慢旋律，富有情感深度的表达' },
  { id: 3, icon: '🎬', name: '史诗宏大', description: '壮阔气势，适合电影配乐的风格' },
  { id: 4, icon: '💭', name: '梦幻缥缈', description: '空灵音色，营造梦境般的氛围' },
  { id: 5, icon: '😰', name: '紧张刺激', description: '急促节拍，制造悬念和紧张感' }
])

const musicCases = ref([
  {
    id: 1,
    emoji: '🎵',
    style: '轻快流行',
    description: '适合日常生活场景的轻松音乐',
    keywords: ['轻快旋律', 'C大调', '木吉他']
  },
  {
    id: 2,
    emoji: '🎼',
    style: '史诗管弦',
    description: '宏大叙事背景音乐，适合游戏和影视',
    keywords: ['管弦乐', '史诗感', '铜管组']
  },
  {
    id: 3,
    emoji: '🎶',
    style: '梦幻电子',
    description: '营造迷幻氛围的电子音乐风格',
    keywords: ['合成器', '环境音效', '空灵人声']
  }
])

const musicKeywords = ref([
  '钢琴', '弦乐', '鼓组', '合成器', 
  '贝斯', '吉他', '环境音效', '人声合唱',
  '打击乐', '铜管组'
])

// AI写作板块数据
const writingTechniques = ref([
  { id: 1, icon: '📚', name: '小说创作', description: '构建完整故事情节与人物塑造技巧' },
  { id: 2, icon: '🌸', name: '诗歌写作', description: '韵律美感与意象表达的创作方法' },
  { id: 3, icon: '📢', name: '广告文案', description: '吸引注意力与促进转化的文案技巧' },
  { id: 4, icon: '🎭', name: '剧本编写', description: '对话驱动与视觉化叙事的写作方式' }
])

const writingCases = ref([
  {
    id: 1,
    emoji: '📖',
    style: '科幻小说',
    description: '以科学技术为基础的幻想故事创作',
    keywords: ['时间旅行', '平行宇宙', '道德选择']
  },
  {
    id: 2,
    emoji: '📝',
    style: '品牌故事',
    description: '通过情感共鸣传递品牌价值的文案',
    keywords: ['品牌理念', '情感连接', '用户故事']
  },
  {
    id: 3,
    emoji: '🎬',
    style: '短剧剧本',
    description: '紧凑情节与生动对话的短篇剧本',
    keywords: ['冲突设置', '角色动机', '高潮转折']
  }
])

const writingKeywords = ref([
  '标题技巧', '情感共鸣', '故事叙述', '行动召唤',
  '修辞手法', '节奏控制', '视角选择', '结尾升华'
])

// 计算属性获取当前路由
const currentRoute = computed(() => router.currentRoute.value.path)

// 组件挂载时的初始化
onMounted(() => {
  console.log('灵感启发页面已加载')
})
</script>

<style scoped>
.inspiration-container {
  position: relative;
  min-height: 100vh;
  width: 100vw;
}

.background-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff; /* 纯白色背景 */
  z-index: -1;
}

.content {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* 导航栏样式 */
.navbar {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.nav-content {
  max-width: 100%;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo h1 {
  font-size: 24px;
  color: #667eea;
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav-links a {
  color: #333;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: color 0.3s;
  position: relative;
  padding: 8px 0;
}

.nav-links a:hover {
  color: #667eea;
}

.nav-links a.active {
  color: #667eea;
  font-weight: 600;
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: #667eea;
  border-radius: 1px;
}

/* 下拉菜单 */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background: white;
  min-width: 160px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  z-index: 1;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 0;
}

.dropdown:hover .dropdown-content {
  display: block;
}

.dropdown-content a {
  color: #333;
  padding: 12px 24px;
  text-decoration: none;
  display: block;
  font-size: 14px;
  transition: all 0.3s;
}

.dropdown-content a:hover {
  background: #f5f5f5;
  color: #667eea;
}

.dropdown:hover .dropbtn {
  color: #667eea;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

/* 用户头像按钮样式 */
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 用户信息悬浮面板 */
.user-profile-popup {
  position: absolute;
  top: 50px;
  right: 0;
  width: 280px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 24px;
  margin-bottom: 12px;
}

.profile-name {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.profile-details {
  margin-bottom: 20px;
}

.profile-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.profile-item:last-child {
  margin-bottom: 0;
}

.item-label {
  color: #666;
  font-size: 14px;
}

.item-value {
  color: #333;
  font-size: 14px;
  font-weight: 500;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-action-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.profile-action-btn:hover {
  background: #f5f5f5;
}

.profile-action-btn.logout {
  background: #fff5f5;
  color: #e53e3e;
}

.profile-action-btn.logout:hover {
  background: #ffebee;
}

.login-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  background: #667eea;
  color: white;
}

.login-btn:hover {
  background: #5568d3;
}

/* 灵感启发页面主要内容 */
.inspiration-main {
  width: 100vw;
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.inspiration-content {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.page-title {
  font-size: 32px;
  font-weight: 700;
  color: #2D3E40;
  text-align: center;
  margin-bottom: 16px;
}

.page-description {
  font-size: 18px;
  color: #4A4A4A;
  text-align: center;
  margin-bottom: 40px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* 创作领域标签页 */
.domain-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.domain-tab {
  padding: 12px 24px;
  border: none;
  border-radius: 30px;
  background: #f0f0f0;
  color: #666;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.domain-tab:hover {
  background: #e0e0e0;
  transform: translateY(-2px);
}

.domain-tab.active {
  background: #667eea;
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 领域内容区域 */
.domain-content {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 创作技巧 */
.technique-section h3,
.cases-section h3,
.keywords-section h3 {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
  text-align: center;
}

.technique-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.technique-card {
  background: white;
  border-radius: 12px;
  padding: 25px 20px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
}

.technique-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.technique-icon {
  font-size: 40px;
  margin-bottom: 15px;
}

.technique-card h4 {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
}

.technique-card p {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}

/* 案例展示 */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.case-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
}

.case-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.case-image .placeholder {
  height: 180px;
  font-size: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
}

.case-info {
  padding: 20px;
}

.case-info h4 {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
}

.case-info p {
  font-size: 16px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 16px;
}

.case-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

/* 关键词推荐 */
.keywords-container {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  margin-bottom: 40px;
}

.keyword-tag {
  background: #f0f0f0;
  color: #666;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.keyword-tag:hover {
  background: #e0e0e0;
  transform: translateY(-2px);
}

/* 底部 */
.footer {
  background: #333;
  color: white;
  text-align: center;
  padding: 40px 24px;
  margin-top: 80px;
  width: 100%;
}

.footer p {
  font-size: 14px;
  opacity: 0.8;
}

/* 响应式 */
@media (max-width: 768px) {
  .technique-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .cases-grid {
    grid-template-columns: 1fr;
  }
  
  .domain-tabs {
    gap: 8px;
  }
  
  .domain-tab {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  .page-title {
    font-size: 28px;
  }
  
  .page-description {
    font-size: 16px;
  }
  
  .technique-section h3,
  .cases-section h3,
  .keywords-section h3 {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .technique-grid {
    grid-template-columns: 1fr;
  }
  
  .domain-tab {
    flex: 1;
    text-align: center;
  }
  
  .nav-content {
    flex-direction: column;
    gap: 15px;
  }
  
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}
</style>